package com.wl.jetpackdemo.banner

import android.widget.ImageView
import android.widget.TextView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.wl.jetpackdemo.R

/**
 *
 * Created by wangliang on 2021/1/28.
 */
class BannerAdapter : BaseQuickAdapter<Banner, BaseViewHolder>(R.layout.item_banner), LoadMoreModule {

    override fun convert(holder: BaseViewHolder, item: Banner) {
        holder.getView<TextView>(R.id.tv_title).text = item.title
        val ivBanner = holder.getView<ImageView>(R.id.iv_banner)
        Glide.with(context).load(item.imagePath)
                .transition(DrawableTransitionOptions.withCrossFade())
                .into(ivBanner)
    }

}